package com.hzlj.position.dbsync.liaoning.common.dto.zhizunWd.response;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.hzlj.position.config.common.dto.common.PositionAddDTO;
import com.hzlj.position.config.common.enums.WarningType;
import com.hzlj.position.dbsync.common.convert.PositionAddConvert;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

@Slf4j
@Data
@NoArgsConstructor
public class ZhizunWdDeviceLocationQueryResultDTO {
    @JsonProperty("Radius")
    private Integer radius;
    @JsonProperty("Speed")
    private Object speed;
    @JsonProperty("B")
    private Integer b;
    @JsonProperty("FL")
    private Integer fl;
    @JsonProperty("Dist")
    private String dist;
    @JsonProperty("MID")
    private String mid;
    @JsonProperty("ImgID")
    private String imgID;
    @JsonProperty("Lon")
    private BigDecimal lon;
    @JsonProperty("City")
    private String city;
    @JsonProperty("Pro")
    private String pro;
    @JsonProperty("Direction")
    private Object direction;
    @JsonProperty("Name")
    private String name;
    @JsonProperty("Str")
    private String str;
    @JsonProperty("UID")
    private String uid;
    @JsonProperty("Desc")
    private String desc;
    @JsonProperty("WID")
    private String wid;
    @JsonProperty("Lat")
    private BigDecimal lat;
    @JsonProperty("Guarder")
    private String guarder;
    @JsonProperty("UT")
    private String ut;


    public PositionAddDTO convert() {
        return PositionAddConvert.convert(
                true,
                WarningType.SUCCESS,
                this.getMid(),
                this.getLon(),
                this.getLat(),
                this.getUt(),
                this.getB(),
                StrUtil.format("{}{}{}{}",
                        ObjectUtil.defaultIfNull(this.getPro(), ""),
                        ObjectUtil.defaultIfNull(this.getCity(), ""),
                        ObjectUtil.defaultIfNull(this.getDist(), ""),
                        ObjectUtil.defaultIfNull(this.getStr(), ""))

        );
    }
}
